<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> 
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>My JSP 'index.jsp' starting page</title>
  </head>
  
  <body>
   <h1>显示当前时间与日期</h1>
    <div>
    <fmt:formatDate value="${date }" pattern="yyyy-MM-dd HH:mm:ss" /> 
     <%=(new java.util.Date()).toLocaleString()%><br>
    </div>
    <p>在页面显示一个时钟</p>
     <p id="demo"></p>
    <script type=text/JavaScript>     
  
   
   function myTimer(){
	var d=new Date();
	var t=d.toLocaleTimeString();
	document.getElementById("demo").innerHTML=t;
}
    window.setInterval("myTimer();", 1000); 
    
    
 </script>
   
  </body>
	 
</html>
